import { Injectable } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';

import { User } from '../user/entities/user.entity';

@Injectable()
export class AuthService {
  constructor(private readonly jwtService: JwtService) {}

  async login(user: User) {
    const payload = { username: user.username, id: user.id };

    return this.jwtService.signAsync(payload);
  }

  logout(user: User) {
    console.log('user', user);
  }
}
